home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
dayquote
/
dayquote.bas
next >
Wrap
BASIC Source File
|
1995-05-09
|
30KB
|
834 lines
DefInt A-Z
CONST FALSE = 0
CONST TRUE = 1
DECLARE SUB DoQuote (FileName$)
DECLARE SUB ParseCommandLine (Num%, Arg$())
DECLARE SUB PutQuote (Text$)
DECLARE SUB PrintDoc (FileName$)
DECLARE SUB ShowGimme ()
DECLARE SUB ShowHelp ()
DECLARE SUB ShowSyntax ()
DIM ErrorString$(76): FOR j = 1 TO 76: READ ErrorString$(j): NEXT
Dim Arguments$(1 To 20)
Dim Shared QuoteText$(1 To 22)
Dim Shared ForeColor, BackColor, Justification
Dim Shared StartCol, EndCol, TopLine, WipeScreen
PRINT
CALL ParseCommandLine(NumArgs%, Arguments$())
IF Arguments$(1) = "" THEN ShowSyntax
FOR i = 1 TO NumArgs%
SELECT CASE LEFT$(Arguments$(i), 2)
CASE "/?"
ShowHelp
CASE "/F"
IF MID$(Arguments$(i), 3, 1) = ":" THEN
ExpectedArg$ = MID$(Arguments$(i), 4, LEN(Arguments$(i)))
SELECT CASE ExpectedArg$
CASE "BLACK", "BLK"
ForeColor% = 1
CASE "BLUE", "BLU"
ForeColor% = 2
CASE "GREEN", "GRN"
ForeColor% = 3
CASE "CYAN", "CYA"
ForeColor% = 4
CASE "RED"
ForeColor% = 5
CASE "MAGENTA", "MAG"
ForeColor% = 6
CASE "BROWN", "BRN"
ForeColor% = 7
CASE "WHITE", "WHT"
ForeColor% = 8
CASE "GRAY", "GREY", "GRY"
ForeColor% = 9
CASE "LTBLUE", "LBL"
ForeColor% = 10
CASE "LTGREEN", "LGR"
ForeColor% = 11
CASE "LTCYAN", "LCY"
ForeColor% = 12
CASE "LTRED", "LRD"
ForeColor% = 13
CASE "LTMAGENTA", "LMG"
ForeColor% = 14
CASE "YELLOW", "YEL"
ForeColor% = 15
CASE "BRWHITE", "BRW"
ForeColor% = 16
CASE ELSE
CommandError = TRUE
PRINT "Invalid foreground specification: "; ExpectedArg$
END SELECT
ExpectedArg$ = ""
ELSE
CommandError = TRUE
PRINT "Missing colon in switch: "; Arguments$(i)
END IF
CASE "/B"
IF MID$(Arguments$(i), 3, 1) = ":" THEN
ExpectedArg$ = MID$(Arguments$(i), 4, LEN(Arguments$(i)))
SELECT CASE ExpectedArg$
CASE "BLACK", "BLK"
BackColor% = 1
CASE "BLUE", "BLU"
BackColor% = 2
CASE "GREEN", "GRN"
BackColor% = 3
CASE "CYAN", "CYA"
BackColor% = 4
CASE "RED"
BackColor% = 5
CASE "MAGENTA", "MAG"
BackColor% = 6
CASE "BROWN", "BRN"
BackColor% = 7
CASE "WHITE", "WHT"
BackColor% = 8
CASE "GRAY", "GREY", "GRY"
BackColor% = 9
CASE "LTBLUE", "LBL"
BackColor% = 10
CASE "LTGREEN", "LGR"
BackColor% = 11
CASE "LTCYAN", "LCY"
BackColor% = 12
CASE "LTRED", "LRD"
BackColor% = 13
CASE "LTMAGENTA", "LMG"
BackColor% = 14
CASE "YELLOW", "YEL"
BackColor% = 15
CASE "BRWHITE", "BRW"
BackColor% = 16
CASE ELSE
CommandError = TRUE
PRINT "Invalid background specification: "; ExpectedArg$
END SELECT
ExpectedArg$ = ""
ELSE
CommandError = TRUE
PRINT "Missing colon in switch: "; Arguments$(i)
END IF
CASE "/L"
IF LEN(Arguments$(i)) = 2 THEN
IF NOT (Justification) THEN
Justification = 1
ELSE
CommandError = TRUE
PRINT "Multiple text justifications are not allowed: "; Arguments$(i)
END IF
ELSE
CommandError = TRUE
PRINT "Invalid switch: "; Arguments$(i)
END IF
CASE "/C"
IF LEN(Arguments$(i)) = 2 THEN
IF NOT (Justification) THEN
Justification = 2
ELSE
CommandError = TRUE
PRINT "Multiple text justifications are not allowed: "; Arguments$(i)
END IF
ELSE
CommandError = TRUE
PRINT "Invalid switch: "; Arguments$(i)
END IF
CASE "/R"
IF LEN(Arguments$(i)) = 2 THEN
IF NOT (Justification) THEN
Justification = 3
ELSE
CommandError = TRUE
PRINT "Multiple text justifications are not allowed: "; Arguments$(i)
END IF
ELSE
CommandError = TRUE
PRINT "Invalid switch: "; Arguments$(i)
END IF
CASE "/S"
IF MID$(Arguments$(i), 3, 1) = ":" THEN
ExpectedArg = VAL(MID$(Arguments$(i), 4, LEN(Arguments$(i))))
IF (ExpectedArg > 0) AND (ExpectedArg < 31) THEN
StartCol = ExpectedArg
ELSE
CommandError = TRUE
PRINT "Invalid starting column: "; MID$(Arguments$(i), 4, LEN(Arguments$(i)))
END IF
ExpectedArg = 0
ELSE
CommandError = TRUE
PRINT "Missing colon in switch: "; Arguments$(i)
END IF
CASE "/E"
IF MID$(Arguments$(i), 3, 1) = ":" THEN
ExpectedArg = VAL(MID$(Arguments$(i), 4, LEN(Arguments$(i))))
IF (ExpectedArg > 49) AND (ExpectedArg < 81) THEN
EndCol = ExpectedArg
ELSE
CommandError = TRUE
PRINT "Invalid ending column: "; MID$(Arguments$(i), 4, LEN(Arguments$(i)))
END IF
ExpectedArg = 0
ELSE
CommandError = TRUE
PRINT "Missing colon in switch: "; Arguments$(i)
END IF
CASE "/T"
IF MID$(Arguments$(i), 3, 1) = ":" THEN
ExpectedArg = VAL(MID$(Arguments$(i), 4, LEN(Arguments$(i))))
IF (ExpectedArg > 0) AND (ExpectedArg < 25) THEN
TopLine = ExpectedArg
ELSE
CommandError = TRUE
PRINT "Invalid top line: "; MID$(Arguments$(i), 4, LEN(Arguments$(i)))
END IF
ExpectedArg = 0
ELSE
CommandError = TRUE
PRINT "Missing colon in switch: "; Arguments$(i)
END IF
CASE "/W"
IF LEN(Arguments$(i)) = 2 THEN
WipeScreen = TRUE
ELSE
CommandError = TRUE
PRINT "Invalid switch: "; Arguments$(i)
END IF
CASE "/$"
IF CommandError = FALSE THEN
IF LEN(Arguments$(i)) = 2 THEN
ShowGimme
ELSE
CommandError = TRUE
PRINT "Invalid switch: "; Arguments$(i)
END IF
END IF
CASE "/D"
ON ERROR GOTO PrintDocError
IF CommandError = FALSE THEN
IF MID$(Arguments$(i), 3, 1) = ":" THEN
FileNa